Computer systems commonly run multiple processes which share data resources between them. In order to avoid corrupting shared data, access to the data by the multiple processes needs to be controlled by an exclusion mechanism such as a data lock. A lock is assigned to or held by a process and enables exclusive access by that process to the associated data. A given lock can be held by only one process at a time.
Some locking systems use shared memory or files to store the locks. The shared memory is accessible to all of the processes that need to share the data. Each process that needs to access the shared memory must be aware of the precise location of the shared memory in order to request a lock. If the location of the shared memory is modified, each process may need to be updated or modified. In other locking systems, a file is created at a commonly agreed location which is visible to all processes and is associated with the shared data. This file can be locked by any processes to indicate that associated data is in use. In an alternative approach, the presence or absence of a file at a given location indicates whether associated data is locked or unlocked respectively. These approaches are widely applicable but have a file management overhead.